How Does It Work?
What is Digital Output?
A digital output on a Tamra board pin can only be in one of two states:
- HIGH: The pin has a voltage (5V on most Tamra boards, 3.3V on some newer boards).
- LOW: The pin has no voltage (0V or connected to GND, which stands for "ground").
You can use digital output pins to control LEDs, motors (with a driver), buzzers, and other electronic components. In this tutorial, we focused on controlling a LED to show how digital outputs work.
In this tutorial, the red A LED is connected to a Tamra digital output pin on one side and to GND on the other side. A 220 ohms (Ω) resistor is placed in series with the LED to limit the current flowing through it.
How It Works:
The LED emits light when current flows from the positive terminal (anode) to the negative terminal (cathode).
Behavior
When the Tamra pin is LOW (0V):
- There is no voltage difference across the LED.
- No current flows through the circuit.
- The LED is OFF.
When the Tamra pin is HIGH (5V):
- There is a voltage difference across the LED.
- Current flows through the LED, making it light up.
- The LED is ON.
Visualization
Graphs
Voltage Graph:
- When the pin is HIGH, the graph shows a jump to 5V.
- When the pin is LOW, the graph stays at 0V.
LED State:
- Time vs. Brightness
- Brightness is 0 when the pin is LOW.
- Brightness increases when the pin is HIGH.
- Time vs. Brightness
Summary
- Digital outputs can only be HIGH or LOW.
- LEDs light up when the output is HIGH and turn off when the output is LOW.
- The Tamra board code controls the state of the digital output pin, which determines whether the LED is ON or OFF.
This simple example shows how digital output works, and you can explore more complex applications like controlling motors or buzzers in the future!